<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link rel="shortcut icon" href="../images/favicon.ico">
    <link rel="apple-touch-icon-precomposed" href="../images/apple-touch-icon.png">
    <title>charts-doughnut-simple</title>
    <link rel="stylesheet" href="../../dist/seedsui.min.css">
</head>
<body>
    <header>
        <div class="titlebar">
            <a class="titlebar-button" href="javascript:back()">
                <i class="icon icon-arrowleft"></i>
            </a>
            <h1 class="titlebar-title">简单环形图</h1>
        </div>
    </header>
    <article>
        <ul class="grid grid-bordered" data-col="4">
            <li style="padding: 16px 0;">
                <div class="SID-ChartBegin" style="width: 50px;height:50px;margin:0 auto;"></div>
            </li>
            <li style="padding: 16px 0">
                <div class="SID-ChartReady" style="width: 50px;height:50px;margin:0 auto;"></div>
            </li>
            <li style="padding: 16px 0">
                <div class="SID-ChartFinish" style="width: 50px;height:50px;margin:0 auto;"></div>
            </li>
            <li style="padding: 16px 0">
                <div class="SID-ChartCancel" style="width: 50px;height:50px;margin:0 auto;"></div>
            </li>
            <li style="padding: 16px 0;">
                <div class="SID-ChartBegin" style="width: 50px;height:50px;margin:0 auto;"></div>
            </li>
            <li style="padding: 16px 0">
                <div class="SID-ChartReady" style="width: 50px;height:50px;margin:0 auto;"></div>
            </li>
            <li style="padding: 16px 0">
                <div class="SID-ChartFinish" style="width: 50px;height:50px;margin:0 auto;"></div>
            </li>
            <li style="padding: 16px 0">
                <div class="SID-ChartCancel" style="width: 50px;height:50px;margin:0 auto;"></div>
            </li>
        </ul>
    </article>
	<script src="../../dist/seedsui.min.js"></script>
    <script src="../scripts/lib/echarts/echarts.simple.min.js"></script>
    <!--Exmobi能力-->
    <!--<script src="../scripts/lib/exmobi/exmobi.js"></script>-->
    <script>
        var view={
            /*=========================
              Model
              ===========================*/
            initialize:function(){
                /*DOM*/
                
                /*Plugin*/
                this.chartBegins=document.querySelectorAll(".SID-ChartBegin");
                this.chartReadys=document.querySelectorAll(".SID-ChartReady");
                this.chartFinishs=document.querySelectorAll(".SID-ChartFinish");
                this.chartCancels=document.querySelectorAll(".SID-ChartCancel");
                /*Data*/

                /*Render*/
                this.render();
                
                /*Events*/
                this._attach();
            },
            render:function(){
                this._initPlugin();
            },
            /*=========================
              Method
              ===========================*/
            _update:function(){
            },
            /*=========================
              Plugin
              ===========================*/
            _getChartOption:function(data){
                return {
                    series: [
                        {
                            type:'pie',
                            radius: ['88%', '100%'],
                            avoidLabelOverlap: false,
                            label: {
                                normal: {//等同于data各项数据中的itemStyle.normal.label(文字样式全书设置)
                                    show: false,
                                    position: 'center',
                                    textStyle:{
                                        fontSize:10
                                    }
                                }
                            },
                            data:data
                        }
                    ]
                };
            },
            _initChartBegin:function(){
                if(this.chartBegins.length<=0)return;
                for(var i=0,div;div=this.chartBegins[i++];){
                    var chart = echarts.init(div);
                    var data=[//各项数据
                        {name:'进行中', value:80,itemStyle : {
                            normal : {
                                color: '#01cd78',
                                label : {show : true}
                            }
                        }},
                        {name:'剩余部分', value:20, itemStyle : {
                            normal : {
                                color: '#c7ffe8'
                            }
                        }},
                    ];
                    var chartOption = this._getChartOption(data);
                    chart.setOption(chartOption);
                }
            },
            _initChartReady:function(){
                if(this.chartReadys.length<=0)return;
                for(var i=0,div;div=this.chartReadys[i++];){
                    var chart = echarts.init(div);
                    var data=[//各项数据
                        {name:'准备中', value:20,itemStyle : {
                            normal : {
                                color: '#ffa274',
                                label : {show : true}
                            }
                        }},
                        {name:'剩余部分', value:80, itemStyle : {
                            normal : {
                                color: '#ffdbcd'
                            }
                        }},
                    ];
                    var chartOption = this._getChartOption(data);
                    chart.setOption(chartOption);
                }
            },
            _initChartFinish:function(){
                if(this.chartFinishs.length<=0)return;
                for(var i=0,div;div=this.chartFinishs[i++];){
                    var chart = echarts.init(div);
                    var data=[//各项数据
                        {name:'已结束', value:100,itemStyle : {
                            normal : {
                                color: '#ff7664',
                                label : {show : true}
                            }
                        }},
                        {name:'剩余部分', value:0, itemStyle : {
                            normal : {
                                color: '#ffbab1'
                            }
                        }},
                    ];
                    var chartOption = this._getChartOption(data);
                    chart.setOption(chartOption);
                }
            },
            _initChartCancel:function(){
                if(this.chartCancels.length<=0)return;
                for(var i=0,div;div=this.chartCancels[i++];){
                    var chart = echarts.init(div);
                    var data=[//各项数据
                        {name:'已取消', value:100,itemStyle : {
                            normal : {
                                color: '#e0e0e0',
                                label : {show : true}
                            }
                        }},
                        {name:'剩余部分', value:0, itemStyle : {
                            normal : {
                                color: '#e0e0e0'
                            }
                        }},
                    ];
                    var chartOption = this._getChartOption(data);
                    chart.setOption(chartOption);
                }
            },
            _initPlugin:function(){
                this._initChartBegin();
                this._initChartReady();
                this._initChartFinish();
                this._initChartCancel();
            },
            /*=========================
              Events
              ===========================*/
            _attach:function(e){
                var self=this;
            },
            /*=========================
              Event Handler
              ===========================*/
        }

        window.addEventListener("load",function(){
            view.initialize();
        }, false);

        //定义exmobi返回
        function back(){history.go(-1);}
    </script>
</body>
</html>